const cloudRequest = data => {
    return new Promise((resolve, reject) => {
        wx.cloud
            .callFunction(data)
            .then(res => {
                if (res.errMsg.includes('ok') && res.result && res.result.status === 200) {
                    resolve(res.result.data);
                } else {
                    reject(res.result);
                }
            })
            .catch(err => {
                reject(err);
            });
    });
};

export { cloudRequest };
